package com.taxshare.purchaser.controller;


import com.taxshare.mybatis.pager.PageRequest;
import com.taxshare.purchaser.entity.BlackWhiteEntity;
import com.taxshare.purchaser.service.BlackWhiteService;
import com.taxshare.purchaser.view.dto.BlackSyncDTO;
import com.taxshare.purchaser.view.dto.BlackWhiteDTO;
import com.taxshare.purchaser.view.dto.SyncBlackDTO;
import com.taxshare.response.beans.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;


/**
 *@ClassName: BlackWhiteController
 *@Description:黑/白名单信息(销项)
 *@author: hjh
 *@date:
 */
@RestController
@RequestMapping(value = "/blackWhite")
@Api(tags = "黑/白名单信息")
public class BlackWhiteController {

    @Autowired
    BlackWhiteService blackWhiteService;

    @Autowired
    RestTemplate restTemplate;

    @RequestMapping(method = RequestMethod.POST, value = "/list")
    @ApiOperation(notes = "黑/白名单", value = "查询名单(status:1->黑名单，0->白名单)")
    public Response blackList(@RequestBody PageRequest<BlackWhiteEntity> query) {
        return blackWhiteService.List(query);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/add/list")
    @ApiOperation(notes = "黑/白名单",value = "新增名单(status:1->黑名单，0->白名单)")
    public Response addList(@RequestBody BlackWhiteDTO blackWhiteDTO){
        return blackWhiteService.addBlackList(blackWhiteDTO);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/delete/list")
    @ApiOperation(notes = "黑/白名单", value = "删除名单(status:1->黑名单，0->白名单)")
    public Response deleteList(@RequestBody BlackWhiteDTO blackWhiteDTO){
        return blackWhiteService.deleteList(blackWhiteDTO);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/edit/list")
    @ApiOperation(notes = "黑/白名单", value = "编辑名单(status:1->黑名单，0->白名单)")
    public Response editList(@RequestBody BlackWhiteDTO blackWhiteDTO) {
        return blackWhiteService.editList(blackWhiteDTO);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/syncBlack")
    @ApiOperation(notes = "同步黑名单", value = "同步黑名单")
    public Response syncBlackInfo(@RequestBody BlackSyncDTO blackSyncDTO) {
        return blackWhiteService.syncBlackInfo(blackSyncDTO);
    }

//    @ApiOperation(notes = "黑名单",value = "导出")
//    @PostMapping("/export/black")
//    public Response exportBlackExcel() throws IOException {
//            return blackWhiteService.exportBlackExcel();
//    }

//    @ApiOperation(notes = "黑名单",value = "导入")
//    @PostMapping("/import/black")
//    public Response uploadBlackExcel(@RequestParam("file") MultipartFile excelFile) throws IOException {
//        return blackWhiteService.uploadBlackExcel(excelFile);
//    }

//    @ApiOperation(notes = "白名单",value = "导入")
//    @PostMapping("/import/white")
//    public Response uploadWhiteExcel(@RequestParam("file") MultipartFile excelFile) throws IOException {
//        return blackWhiteService.uploadWhiteExcel(excelFile)
//    }
}
